﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;

namespace TeamCityMonitor.Repository
{
    public interface IUrlRepository
    {
        bool UrlExists(string url);
    }

    public class UrlRepository : IUrlRepository
    {
        public bool UrlExists(string url)
        {
            try
            {
                using (var client = new WebClient())
                {
                    client.DownloadData(url);
                }
            }
            catch (Exception)
            {
                return false;
            }
            return true;
        }
    }
}